| Total Complexity | 3 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import React, { Component } from "react" |
||
| 2 | |||
| 3 | class MiniRanking extends Component { |
||
| 4 | render() { |
||
| 5 | if (this.props.ranking.length <= 0) { |
||
| 6 | return <span>Nog geen klassement opgemaakt</span> |
||
| 7 | } |
||
| 8 | |||
| 9 | this.props.ranking.sort((a, b) => { |
||
| 10 | return a && a.position - b.position |
||
| 11 | }) |
||
| 12 | |||
| 13 | return ( |
||
| 14 | <table> |
||
| 15 | <thead> |
||
| 16 | <tr> |
||
| 17 | <th>#</th> |
||
| 18 | <th>Team</th> |
||
| 19 | <th>Pts</th> |
||
| 20 | </tr> |
||
| 21 | </thead> |
||
| 22 | <tbody> |
||
| 23 | {this.props.ranking.map((rank, i) => { |
||
| 24 | return ( |
||
| 25 | rank && ( |
||
| 26 | <tr key={i}> |
||
| 27 | <td>{rank.position}</td> |
||
| 28 | <td |
||
| 29 | className={ |
||
| 30 | rank.team.includes("Elewijt") |
||
| 31 | ? "team-ranking__winner" |
||
| 32 | : undefined |
||
| 33 | } |
||
| 34 | > |
||
| 35 | {rank.team} |
||
| 36 | </td> |
||
| 37 | <td>{rank.points}</td> |
||
| 38 | </tr> |
||
| 39 | ) |
||
| 40 | ) |
||
| 41 | })} |
||
| 42 | </tbody> |
||
| 43 | </table> |
||
| 44 | ) |
||
| 49 |